package com.liliudong.makabaka.controller.sys;

import com.liliudong.makabaka.common.R;
import com.liliudong.makabaka.sys.entity.SysMenu;
import com.liliudong.makabaka.sys.service.SysMenuService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 系统菜单控制器
 *
 * @author liudo
 * @version 1.0
 * @project makabaka-backend
 * @date 2023/9/24 11:12:39
 */
@RestController
@RequestMapping("/v1/sys-menu")
@RequiredArgsConstructor
public class SysMenuController {

    private final SysMenuService sysMenuService;


    /**
     * 树
     *
     * @return {@link R}<{@link List}<{@link SysMenu}>>
     */
    @GetMapping("/tree")
    public R<List<SysMenu>> tree() {
        List<SysMenu> sysMenuList = sysMenuService.getTree();
        return R.success(sysMenuList);
    }
}
